﻿@model Web.BaseModel
@{
    ViewBag.Title = "Default";
}

<title>顾客列表</title>
<script src="~/js/jquery-1.6.2.min.js"></script>
<script src="/js/common.js" type="text/javascript"></script>
<link href="/css/common.css" rel="stylesheet" type="text/css" />
<link href="/css/UserManager.css" rel="stylesheet" type="text/css" />

<div class="pageTitle">
    <p><img src="/css/image/tubiao_28.png" />您的位置：<span>顾客列表</span></p>
</div>

<div class="queryConditionDiv">
    <div class="queryText">
        <span>姓名：</span>
        <input type="text" id="Name" class="textinput" />

        <span>电话：</span>
        <input type="text" id="Phone" class="textinput" />
    </div>

    <input id="btnSearch" type="button" value="" class="queryButton" />
</div>

<div class="List_head">
    <div class="head_left"></div>
    <div class="head_bj">
        <div class="xiangxi">顾客列表</div>
        <a class="xinZeng" href="Edit"></a>
    </div>
    <div class="head_right"></div>
</div>

<div class="list_table" id="divTabel">
    <table class="dataShowTable" id="tb">
        <tr>
            <th class="checkbox_head_th">
                全选<input type="checkbox" id="checkbox_head" onchange="checkAllOrNone('tb', this)" />
            </th>
            <th>姓名</th>
            <th>电话</th>
            <th>工号</th>
            <th>昵称</th>
            <th>操作</th>
        </tr>

    </table>

    <div id="BOX_overlay">
        <div id="ajaxinfo"></div>
    </div>
</div>
<div id="divHidden">
    <input type="hidden" id="strWhere" />
    <input type="hidden" id="PageIndex" value="1" />
    <input type="hidden" id="TotalPages" value="1" />
</div>
<script type="text/javascript">
    $(function () {//页面加载完成执行
        getDataDrawTable("", 1, '@Url.Action("GetEmployee")');
        $("#btnSearch").click(search);
    });
    function turnPage(pageIndex) {
        getDataDrawTable($("#strWhere").val(), pageIndex, '@Url.Action("GetEmployee")');
    }

    function search() {
        var strWhere = "";
        var Name = $("#Name").val();
        var Phone = $("#Phone").val();
        if ($.trim(Name) != "")
            strWhere += " AND Name LIKE '%" + Name + "%'";
        if ($.trim(Phone) != "")
            strWhere += " AND Phone LIKE '%" + Phone + "%'";

        //var pageIndex = $("#pageIndex").val();
        getDataDrawTable(strWhere, 1);
    }

    function drawTable(list) {//success的回调函数
        removeAll("tb");
        var table = $("#tb");
        for (var i = 0; i < list.length; i++) {
            var tr = $("<tr>");
            tr.attr('id', "tr" + list[i]["Id"]);

            tr.append($("<td><input type='checkbox' value='" + list[i]["Id"] + "' /></td>"));

            tr.append($("<td class=''>" + format(list[i]["Name"]) + "</td>"));
            tr.append($("<td class=''>" + format(list[i]["Phone"]) + "</td>"));
            tr.append($("<td class=''>" + format(list[i]["Empno"]) + "</td>"));
            tr.append($("<td class=''>" + format(list[i]["Nickname"]) + "</td>"));

            tr.append($("<td class=''>"
                + "<a href='Edit?Id=" + list[i]["Id"] + "'>修改</a>"
                + "<a href='javascript:void(0)' onclick=\"del('OrganizationEdit.aspx' , " + list[i]["Id"] + ")\">删除</a>"
                + "</td>"));
            table.append(tr);
        }
    }

</script>
